package com.lab.action;

import java.io.IOException;
import java.util.List;

import com.lab.pojo.Users;
import com.lab.service.UsersService;
import com.lab.util.Const;

public class UsersAction extends BaseAction {
	
	public UsersService usersService;
	public void setUsersService(UsersService usersService) {
		this.usersService = usersService;
	}
	public String findAll() throws IOException{
		rows=(List<Users>) usersService.findAll();
		total = 30;
		page = 3;
//		response.setCharacterEncoding("UTF-8");
//		out = response.getWriter();
//		out.write("adfjadfjlkadjf");
		return SUCCESS;
	}
	
	
	public String saveUser() throws IOException{
		Users users = new Users(username,password,role,phoneCode,remark);
		String result = usersService.saveUsers(users);
		if(result.equals(Const.SUCCESS)){
			response.setCharacterEncoding("UTF-8");
			out = response.getWriter();
			out.write("保存成功");
			//out.println(Const.SUCCESS);
			out.flush();
			out.close();
		}else{
			
		}
		
		return null;
	}
	public int total;
	public int page;
	
	public List<Users> rows;
	private Integer id;
	private String username;
	private String password;
	private String role;
	private String phoneCode;
	private String remark;
	
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public String getRole() {
		return role;
	}
	public void setRole(String role) {
		this.role = role;
	}
	public String getPhoneCode() {
		return phoneCode;
	}
	public void setPhoneCode(String phoneCode) {
		this.phoneCode = phoneCode;
	}
	public String getRemark() {
		return remark;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}
	public List<Users> getRows() {
		return rows;
	}
	public void setRows(List<Users> rows) {
		this.rows = rows;
	}
	public int getTotal() {
		return total;
	}
	public void setTotal(int total) {
		this.total = total;
	}
	public int getPage() {
		return page;
	}
	public void setPage(int page) {
		this.page = page;
	}
	
	
}
